package core;

import model.DataSet;
import api.GUIapi;

public class Process implements Runnable {

	private FileProcessor fileProcessor;
	private GUIapi api;

	public Process(GUIapi api) {
		this.fileProcessor = new FileProcessor();
		this.api = api;
	}

	@Override
	public void run() {
		DataSet traningSet = api.getTrainingDataSet();
		DataSet testSet = api.getTestDataSet();
		fileProcessor.setTotalRecords(api.getTrainingDataSet()
				.getNumConeccoes() + api.getTestDataSet().getNumConeccoes());

		System.out.println("INICIO");
		try {
			fileProcessor.startFileStriming(traningSet, api);
		} catch (Exception e) {
			System.err.println("TERMINOU OS TREINOS");
		}

		try {
			fileProcessor.startFileStriming(testSet, api);
		} catch (Exception e) {
			System.err.println("TERMINOU OS TESTES");
		}

		api.setProgressValue(100);

		System.out.println("FIM");

		api.showMessage(fileProcessor.getMessages());

	}
}
